package com.google.code.sapwcrawler.urlfilter;
import java.net.URL;
import java.util.*;

public class UniqURLFilter extends URLFilterDecorator
{
	private Set<URL> set = Collections.synchronizedSet(new HashSet<URL>());
	
	public boolean isDownloadableURL(URL url)
	{
		if(_isDownloadableURL(url))
		{
			set.add(url);
			return true;
		}
		return false;
	}
	
	private boolean _isDownloadableURL(URL url)
	{
		return getUrlFilter().isDownloadableURL(url) && !set.contains(url);
	}
}
